

#include<iostream>;
using namespace std;
#include<cstdio>
#include<cstring>

void bubbleSort(int *arr, int n)
{
    for(int i = n - 1; i > 0; i--)
        for(int j = 0; j < i; j++)
            if(arr[j] > arr[j+1]) 
                swap(arr[j], arr[j+1]);
}

void printArr(int * arr , int len )
{
    for (int i = 0;i<len;i++)
    {
        cout<<"第"<<i<<"个元素为："<<arr[i]<<endl;
    }
}


struct   Student
{
    /* data */
    string name;
    int age;
    float score;

};


void swap(int &a, int &b)
{
int tmp = a;
a = b;
b= tmp;

}

int main(int argc, char const *argv[])
{
    /* code */

    int arr [10] = {1,2,5,9,8,7,6,3,10,4};
    int len  = sizeof(arr)/sizeof(arr[0]);

    bubbleSort(arr,len);
    printArr(arr,len);


    
    printf( "%d", 5 );
    
    char *s = "This code written by 蜀都客车";
	int i = 0;
    cout<<strlen(s)<<endl;
	while( i < strlen(s) )
	{
		printf( "%c", s[i] );
		i++;
    }

     Student  s1 = {"张三",18,99};

    cout << s1.name<<s1.age<<s1.score<<endl;

    Student *s2 = &s1;
    cout<<s2->age<<s2->name<<s2->score<<endl;

//引用传递
int x1 = 10;
int x2 = 20;

swap(x1,x2);
cout<<"x1:"<<x1<<endl;
cout<<"x2:"<<x2<<endl;
    
    return 0;
}
